var counter = 0;

while(!BSShell && counter < 10000) {
    var x = 1000000 * 10000000 / 2345; //komplex calc to slow down the loop
    counter++;
}

if(counter >= 1000) {
    alert("could not load the shell");
} else {
    top.bsShell = new BSShell(window.debug.path);
}